package com.study8.jetcache.service.impl;

import com.alicp.jetcache.anno.CacheInvalidate;
import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.CacheUpdate;
import com.alicp.jetcache.anno.Cached;
import com.study8.jetcache.service.BaseSupplierService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author xuly
 * @title: BaseSupplierServiceImpl
 * @projectName spring-boot
 * @description: TODO
 * @date 2019-07-3017:15
 **/
@Service
@Slf4j
public class BaseSupplierServiceImpl implements BaseSupplierService {

    @Override
    @Cached(name="study8-jetcache",key = "'BaseSupplierServiceImpl_getById'+ #id",cacheType = CacheType.BOTH,expire = 3600)
    public String getById(Integer id) {
        log.info("BaseSupplierServiceImpl --> getById");
        return "" + id;
    }

    @Override
    @CacheInvalidate(name="study8-jetcache",key = "'BaseSupplierServiceImpl_getById'+ #id")
    public void deleteId(Integer id) {

    }

    @Override
    @CacheUpdate(name="study8-jetcache",key = "'BaseSupplierServiceImpl_getById'+ #id",value = "")
    public String update(Integer id) {
        log.info("BaseSupplierServiceImpl --> getById");
        return "update";
    }
}
